<template>
  <div class="form-container">
    <!-- 顶部标题和描述 -->
    <h1>Achenbach儿童行为量表(CBCL)</h1>
    <p>（家长用，适用于4—16岁儿童）</p>

    <!-- 第一部分内容 -->
    <div v-if="currentPart === 1">
      <h3 class="center-text">第一部分：一般项目</h3>
      <el-form :model="form" label-width="120px" class="demo-form">
        <!-- 儿童姓名和性别 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="儿童姓名：" label-width="100px">
              <BottomBorderInput v-model="form.first.childName" width="100px"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="性别：" label-width="100px">
              <el-radio v-model="form.first.gender" label="1">男</el-radio>
              <el-radio v-model="form.first.gender" label="2">女</el-radio>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 年龄和出生日期 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="年龄：" label-width="100px">
              <BottomBorderInput v-model="form.first.age" width="100px"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="出生日期：" label-width="100px">
              <BottomBorderInput v-model="form.first.birth.year" width="40px"/>
              年
              <BottomBorderInput v-model="form.first.birth.month" width="20px"/>
              月
              <BottomBorderInput v-model="form.first.birth.day" width="20px"/>
              日
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 年级和民族 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="年级：" label-width="100px">
              <BottomBorderInput v-model="form.first.grade" width="100px"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="民族：" label-width="100px">
              <BottomBorderInput v-model="form.first.ethnicity" width="130px"/>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 父亲职业和母亲职业 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="父亲职业：" label-width="100px">
              <BottomBorderInput v-model="form.first.fatherOccupation" width="350px"
                                 placeholder="（请填具体，例如车工、鞋店售货员、主妇等）"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="母亲职业：" label-width="100px">
              <BottomBorderInput v-model="form.first.motherOccupation" width="350px"
                                 placeholder="（请填具体，例如车工、鞋店售货员、主妇等）"/>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 填表者和填表日期 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="填表者：" label-width="100px">
              <el-radio v-model="form.first.writer" label="1">父</el-radio>
              <el-radio v-model="form.first.writer" label="2">母</el-radio>
              <el-radio v-model="form.first.writer" label="3">其他人</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="填表日期：" label-width="100px">
              <BottomBorderInput v-model="form.first.complete.year" width="40px"/>
              年
              <BottomBorderInput v-model="form.first.complete.month" width="20px"/>
              月
              <BottomBorderInput v-model="form.first.complete.day" width="20px"/>
              日
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 门诊号和住院号 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="门诊号：" label-width="100px">
              <BottomBorderInput v-model="form.first.patientNumber" width="240px"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="住院号：" label-width="100px">
              <BottomBorderInput v-model="form.first.admissionNumber" width="240px"/>
            </el-form-item>
          </el-col>
        </el-row>

        <!-- 就诊卡号 -->
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="就诊卡号：" label-width="100px">
              <BottomBorderInput v-model="form.first.cardNumber" width="240px"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>

    <!-- 第二部分内容 -->
    <div v-else-if="currentPart === 2">
      <h3 class="center-text">第二部分：社会能力</h3>
      <h3 class="center-text">一</h3>
      <div>
        <p>（1）请列出你孩子最爱好的体育运动项目（例如，游泳，棒球等）：</p>
        <HobbySelector
            :options="questions.v1_1Options" :inputCount="3" v-model="form.second.v1_1hobbies"
            :selectedOption="form.second.v1_1" @update:selectedOption="form.second.v1_1 = $event"
            :placeholder="['请输入爱好','请输入爱好','请输入爱好']" width="200px"
        />
      </div>
      <div>
        <p>（2）与同龄儿童相比，他（她）在这些项目上花去时间多少？</p>
        <DynamicRadioGroup :options="questions.v1_2Options" v-model="form.second.v1_2"/>
      </div>
      <div>
        <p>（3）与同龄儿童相比，他（她）的运动水平如何？</p>
        <DynamicRadioGroup :options="questions.v1_3Options" v-model="form.second.v1_3"/>
      </div>

      <br>
      <h3 class="center-text">二</h3>
      <div>
        <p>（1）请列出你孩子在体育运动以外的爱好（例如集邮，看书，弹琴等，不包括看电视）：</p>
        <HobbySelector
            :options="questions.v1_1Options" :inputCount="3" v-model="form.second.v2_1hobbies"
            :selectedOption="form.second.v2_1" @update:selectedOption="form.second.v2_1 = $event"
            :placeholder="['请输入爱好','请输入爱好','请输入爱好']" width="200px"
        />
      </div>
      <div>
        <p>（2）与同龄儿童相比，他（她）花在这些爱好上的时间多少？</p>
        <DynamicRadioGroup :options="questions.v1_2Options" v-model="form.second.v2_2"/>
      </div>
      <div>
        <p>（3）与同龄儿童相比，他（她）的爱好水平如何？</p>
        <DynamicRadioGroup :options="questions.v1_3Options" v-model="form.second.v2_3"/>
      </div>

      <br>
      <h3 class="center-text">三</h3>
      <div>
        <p>（1）请列出你孩子参加的组织、俱乐部、团队或小组的名称：</p>
        <HobbySelector
            :options="questions.v3_1Options" :inputCount="3" v-model="form.second.v3_1hobbies"
            :selectedOption="form.second.v3_1" @update:selectedOption="form.second.v3_1 = $event"
            :placeholder="['请输入名称','请输入名称','请输入名称']" width="200px"
        />
      </div>
      <div>
        <p>（2）与同龄的参加者相比，他（她）在这些组织中的活跃程度如何？</p>
        <DynamicRadioGroup :options="questions.v1_3Options" v-model="form.second.v3_2"/>
      </div>

      <br>
      <h3 class="center-text">四</h3>
      <div>
        <p>（1）请列出你孩子有无千活或打零工的情况（例如送报，帮人照顾小孩，帮人搞卫生等）：</p>
        <HobbySelector
            :options="questions.v4_1Options" :inputCount="3" v-model="form.second.v4_1hobbies"
            :selectedOption="form.second.v4_1" @update:selectedOption="form.second.v4_1 = $event"
            :placeholder="[]" width="200px"
        />
      </div>
      <div>
        <p>（2）与同龄儿童相比，他（她）工作质量如何？</p>
        <DynamicRadioGroup :options="questions.v4_2Options" v-model="form.second.v4_2"/>
      </div>

      <br>
      <h3 class="center-text">五</h3>
      <div>
        <p>（1）你孩子有几个要好的朋友？</p>
        <DynamicRadioGroup :options="questions.v5_1Options" v-model="form.second.v5_1"/>
      </div>
      <div>
        <p>（2）与同龄儿童相比，他（她）工作质量如何？</p>
        <DynamicRadioGroup :options="questions.v5_2Options" v-model="form.second.v5_2"/>
      </div>

      <br>
      <h3 class="center-text">六</h3>
      <div>
        <p>&ensp;与同龄儿童相比，你孩子在下列方面表现如何？</p>
        <div class="row">
          <p>&ensp;a.与兄弟姐妹相处</p>
          <DynamicRadioGroup :options="questions.v6Options" v-model="form.second.v6_1_1"/>
        </div>
        <div class="row">
          <p>&ensp;b.与其他儿童相处</p>
          <DynamicRadioGroup :options="questions.v6Options" v-model="form.second.v6_1_2"/>
        </div>
        <div class="row">
          <p>&ensp;c.对父母的行为</p>
          <DynamicRadioGroup :options="questions.v6Options" v-model="form.second.v6_1_3"/>
        </div>
        <div class="row">
          <p>&ensp;d.自己工作和游戏</p>
          <DynamicRadioGroup :options="questions.v6Options" v-model="form.second.v6_1_4"/>
        </div>
      </div>

      <br>
      <h3 class="center-text">七</h3>
      <div>
        <p>（1）当前学习成绩（对六岁以上儿童而言）</p>
        <el-radio-group v-model="form.second.v7_1" class="select-container">
          <el-radio label="1">未上学</el-radio>
          <el-radio label="2">已上学</el-radio>
        </el-radio-group>
        <div v-if="form.second.v7_1 === '2'" class="select-container">
          <div class="row">
            <p>&ensp;a. 阅读课</p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_1"/>
          </div>
          <div class="row">
            <p>&ensp;b. 写作课</p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_2"/>
          </div>
          <div class="row">
            <p>&ensp;c. 算术课</p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_3"/>
          </div>
          <div class="row">
            <p>&ensp;d. 拼音课</p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_4"/>
          </div>
          <div class="row">
            <p>&ensp;e.
              <BottomBorderInput v-model="devs.class1" width="100px"/>
            </p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_5"/>
          </div>
          <div class="row">
            <p>&ensp;f.
              <BottomBorderInput v-model="devs.class2" width="100px"/>
            </p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_6"/>
          </div>
          <div class="row">
            <p>&ensp;g.
              <BottomBorderInput v-model="devs.class3" width="100px"/>
            </p>
            <DynamicRadioGroup :options="questions.v7_1Options" v-model="form.second.v7_1_7"/>
          </div>
        </div>
      </div>
      <div>
        <p>（2）你孩子是否在特殊班级？</p>
        <HobbySelector
            :options="questions.v7_2Options" :inputCount="1" v-model="form.second.v7_2hobbies"
            :selectedOption="form.second.v7_2" @update:selectedOption="form.second.v7_2 = $event"
            :placeholder="['什么性质？']" width="200px"
        />
      </div>
      <div>
        <p>（3）你孩子是否留级？</p>
        <HobbySelector
            :options="questions.v7_3Options" :inputCount="2" v-model="form.second.v7_3hobbies"
            :selectedOption="form.second.v7_3" @update:selectedOption="form.second.v7_3 = $event"
            :placeholder="['几年级留级？','留级理由？']" width="200px"
        />
      </div>
      <div>
        <p>（4）你孩子在学校里有无学习或其他问题（不包括上面三个问题）？</p>
        <HobbySelector
            :options="questions.v7_4Options" :inputCount="2" v-model="form.second.v7_4hobbies"
            :selectedOption="form.second.v7_4" @update:selectedOption="form.second.v7_4 = $event"
            :placeholder="['问题内容','问题何时开始']" :placeFlag="true" width="200px"
        />
        <div v-if="form.second.v7_4 === '2'">
          <p>问题是否已解决？</p>
          <HobbySelector
              :options="questions.v7_4_1Options" :inputCount="1" v-model="form.second.v7_4_1hobbies"
              :selectedOption="form.second.v7_4_1" @update:selectedOption="form.second.v7_4_1 = $event"
              :placeholder="['何时解决']" :placeFlag="true" width="200px"
          />
        </div>
      </div>
    </div>

    <!-- 第三部分内容 -->
    <div v-else-if="currentPart === 3">
      <h3 class="center-text">第三部分：行为问题</h3>
      <div class="description_item">
        <b>八.</b>&ensp;以下是描述你孩子的项目。只根据最近半年内的情况描
        述。每一项目后面都有三个数字（0，1，2），如你孩子明显有或经常有此项表现，圈2；如无这些表现，圈0。
      </div>
      <BehaviorList :contentList="questions.v8" v-model="form.third.marks" />
      <h4>说明内容</h4>

      <div class="description_item"> 过敏性症状（填具体表现）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc1"></el-input>

      <div class="description_item"> 老是想某些事情，不能摆脱，强迫观念（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc2"></el-input>

      <div class="description_item"> 好吃不能作为食物的东西（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc3"></el-input>

      <div class="description_item"> 除怕上学外，还害怕某些动物、处境或地方（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc4"></el-input>

      <div class="description_item"> 听到某些实际上没有的声音（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc5"></el-input>

      <div class="description_item"> 动作紧张或带有抽动性（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc6"></el-input>

      <div class="description_item"> 眼睛有问题（说明内容。译注：不包括近视及器质性眼病）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc7"></el-input>

      <div class="description_item"> 其他的找不到原因的躯体症状</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc8"></el-input>

      <div class="description_item"> 挖鼻孔、皮肤或身体其他部分（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc9"></el-input>

      <div class="description_item"> 不断重复某些动作，强迫行为（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc10"></el-input>

      <div class="description_item"> 看到某些实际上没有的东西（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc11"></el-input>

      <div class="description_item"> 性方面的问题（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc12"></el-input>

      <div class="description_item"> 比大多数孩子睡得多（说明多多少。译注：不包括赖床）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc13"></el-input>

      <div class="description_item"> 言语问题（说明内容。译注：例如口吃不清）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc14"></el-input>

      <div class="description_item"> 收藏自己不需要的东西（说明内容。译注：不包括集邮等爱好）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc15"></el-input>

      <div class="description_item"> 怪异行为（说明内容。译注：不包括其他条已提及者）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc16"></el-input>

      <div class="description_item"> 怪异想法（说明内容。译注：不包括其他条已提及者）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc17"></el-input>

      <div class="description_item"> 收藏自己不需要的东西（说明内容。译注：不包括集邮等爱好）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc18"></el-input>

      <div class="description_item"> 说梦话或有梦游（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc19"></el-input>

      <div class="description_item"> 睡眠不好（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc20"></el-input>

      <div class="description_item"> 喝酒或使用成瘾药（说明内容）</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc21"></el-input>

      <div class="description_item"> 其他问题</div>
      <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.third.desc.desc22"></el-input>

      <h4>请检查一下是否每条都已填好</h4>
    </div>

    <!-- 分页按钮 -->
    <div style="width: 100%; text-align: center;">
      <el-button type="primary" @click="goBack" v-if="currentPart ===1">返回</el-button>
      <el-button type="primary" @click="prevPart" v-if="currentPart !== 1">上一页</el-button>
      <el-button type="primary" @click="nextPart" v-if="currentPart !== 3">下一页</el-button>
      <el-button type="success" @click="onSubmit" v-if="currentPart === 3">提交</el-button>
    </div>
  </div>
</template>

<script>
// import BottomBorderInput from '../../components/BottomBorderInput.vue'; // 引入封装后的组件
// import HobbySelector from '../../components/HobbySelector.vue';
// import DynamicRadioGroup from '../../components/DynamicRadioGroup.vue';
// import BehaviorList from '../../components/BehaviorList.vue';
// import axios from 'axios';

import BottomBorderInput from "@/views/components/BottomBorderInput.vue";
import HobbySelector from "@/views/components/HobbySelector.vue";
import DynamicRadioGroup from "@/views/components/DynamicRadioGroup.vue";
import BehaviorList from "@/views/components/BehaviorList.vue";
import axios from "axios";
import {addDcpResult, addResult, getDcpResult} from "@/api/dcp/result";
import {updateScreen} from "@/api/dcp/screen";
import path from "path";

export default {
  components: {
    BottomBorderInput,
    HobbySelector,
    DynamicRadioGroup,
    BehaviorList
  },
  data() {
    return {

      currentPart: 1, // 当前部分，默认为第一部分
      first1: {
        childName: undefined,
        gender: undefined,
        age: undefined,
        birth: {
          year: undefined,
          month: undefined,
          day: undefined,
        },
        grade: undefined,
        ethnicity: undefined,
        fatherOccupation: undefined,
        motherOccupation: undefined,
        writer: undefined,
        complete: {
          year: undefined,
          month: undefined,
          day: undefined,
        },
        patientNumber: undefined,
        admissionNumber: undefined,
        cardNumber: undefined
      },
      //第二部分
      second1: {
        v1_1: undefined,
        v1_1hobbies: Array(3).fill(''), // 初始化爱好值数组
        v1_2: undefined,
        v1_3: undefined,
        v2_1: undefined,
        v2_1hobbies: Array(3).fill(''),
        v2_2: undefined,
        v2_3: undefined,
        v3_1hobbies: Array(3).fill(''),
        v3_1: undefined,
        v3_2: undefined,
        v4_1hobbies: Array(3).fill(''),
        v4_1: undefined,
        v4_2: undefined,
        v5_1: undefined,
        v5_2: undefined,
        v6_1_1: undefined,
        v6_1_2: undefined,
        v6_1_3: undefined,
        v6_1_4: undefined,
        v7_1: undefined,
        v7_1_1: undefined,
        v7_1_2: undefined,
        v7_1_3: undefined,
        v7_1_4: undefined,
        v7_1_5: undefined,
        v7_1_6: undefined,
        v7_1_7: undefined,
        v7_2hobbies: Array(1).fill(''),
        v7_2: undefined,
        v7_3hobbies: Array(2).fill(''),
        v7_3: undefined,
        v7_4hobbies: Array(2).fill(''),
        v7_4: undefined,
        v7_4_1hobbies: Array(1).fill(''),
        v7_4_1: undefined,
      },
      //第三部分
      third1: {
        marks: [],
        desc: {
          desc1: undefined,
          desc2: undefined,
          desc3: undefined,
          desc4: undefined,
          desc5: undefined,
          desc6: undefined,
          desc7: undefined,
          desc8: undefined,
          desc9: undefined,
          desc10: undefined,
          desc11: undefined,
          desc12: undefined,
          desc13: undefined,
          desc14: undefined,
          desc15: undefined,
          desc16: undefined,
          desc17: undefined,
          desc18: undefined,
          desc19: undefined,
          desc20: undefined,
          desc21: undefined,
          desc22: ''
        }
      },
      form: {
        //第一部分
        first: {
          childName: "张三",
          gender: "1",
          age: "8",
          birth: {
            year: "2018",
            month: "4",
            day: "1",
          },
          grade: "二年级",
          ethnicity: "汉",
          fatherOccupation: "农民",
          motherOccupation: "工人",
          writer: "1",
          complete: {
            year: "2025",
            month: "4",
            day: "1",
          },
          patientNumber: "10011",
          admissionNumber: "10012",
          cardNumber: "500"
        },

        //第二部分
        second: {
          v1_1: "1",
          v1_1hobbies: Array(3).fill(''), // 初始化爱好值数组
          v1_2: "1",
          v1_3: "1",
          v2_1: "1",
          v2_1hobbies: Array(3).fill(''),
          v2_2: "1",
          v2_3: "1",
          v3_1hobbies: Array(3).fill(''),
          v3_1: "1",
          v3_2: "1",
          v4_1hobbies: Array(3).fill(''),
          v4_1: "1",
          v4_2: "1",
          v5_1: "1",
          v5_2: "1",
          v6_1_1: "1",
          v6_1_2: "1",
          v6_1_3: "1",
          v6_1_4: "1",
          v7_1: "1",
          v7_1_1: "1",
          v7_1_2: "1",
          v7_1_3: "1",
          v7_1_4: "1",
          v7_1_5: "1",
          v7_1_6: "1",
          v7_1_7: "1",
          v7_2hobbies: Array(1).fill(''),
          v7_2: "1",
          v7_3hobbies: Array(2).fill(''),
          v7_3: "1",
          v7_4hobbies: Array(2).fill(''),
          v7_4: "1",
          v7_4_1hobbies: Array(1).fill(''),
          v7_4_1: "1",
        },
        //第三部分
        third: {
          marks: [],
          desc: {
            desc1: "无",
            desc2: "无",
            desc3: "无",
            desc4: "无",
            desc5: "无",
            desc6: "无",
            desc7: "无",
            desc8: "无",
            desc9: "无",
            desc10: "无",
            desc11: "无",
            desc12: "无",
            desc13: "无",
            desc14: "无",
            desc15: "无",
            desc16: "无",
            desc17: "无",
            desc18: "无",
            desc19: "无",
            desc20: "无",
            desc21: "无",
            desc22: "无"
          }
        },
      },
      //题目数据
      questions: {
        //第二部分
        v1_1Options: [
          {name: '无爱好', label: '1'},
          {name: '有爱好', label: '2'},
        ],
        v1_2Options: [
          {name: '不知道', label: '1'},
          {name: '较少', label: '2'},
          {name: '一般', label: '3'},
          {name: '较多', label: '4'}
        ],
        v1_3Options: [
          {name: '不知道', label: '1'},
          {name: '较低', label: '2'},
          {name: '一般', label: '3'},
          {name: '较高', label: '4'}
        ],
        v3_1Options: [
          {name: '未参加', label: '1'},
          {name: '参加', label: '2'},
        ],
        v4_1Options: [
          {name: '没有', label: '1'},
          {name: '有', label: '2'},
        ],
        v4_2Options: [
          {name: '不知道', label: '1'},
          {name: '较差', label: '2'},
          {name: '一般', label: '3'},
          {name: '较好', label: '4'}
        ],
        v5_1Options: [
          {name: '无', label: '1'},
          {name: '1个', label: '2'},
          {name: '2-3个', label: '3'},
          {name: '4个及以上', label: '4'}
        ],
        v5_2Options: [
          {name: '不到一次', label: '1'},
          {name: '1-2次', label: '2'},
          {name: '3次及以上', label: '3'}
        ],
        v6Options: [
          {name: '较差', label: '1'},
          {name: '差不多', label: '2'},
          {name: '较好', label: '3'}
        ],
        v7_1Options: [
          {name: '不及格', label: '1'},
          {name: '中等以下', label: '2'},
          {name: '中等', label: '3'},
          {name: '中等以上', label: '4'}
        ],
        v7_2Options: [
          {name: '不是', label: '1'},
          {name: '是', label: '2'},
        ],
        v7_3Options: [
          {name: '没有', label: '1'},
          {name: '留过', label: '2'},
        ],
        v7_4Options: [
          {name: '没有', label: '1'},
          {name: '有问题', label: '2'},
        ],
        v7_4_1Options: [
          {name: '已解决', label: '1'},
          {name: '未解决', label: '2'},
        ],
        //第二部分
        v8: [
          "1. 行为幼稚与其年龄不符",
          "2. 喜欢争论",
          "3. 精神不能集中，注意力不能持久",
          "4. 哮喘病",
          "5. 举动向异性",
          "6. 随地大便",
          "7. 喜欢吹牛或自夸",
          "8. 精神不能集中，注意力不能持久",
          "9. 老是想某些事情，不能摆脱，强迫观念（说明内容） ",
          "10. 坐立不安活动过多",
          "11. 喜欢缠着大人或过分依赖",
          "12. 常说感到寂寞",
          "13. 胡里胡涂，如在云里雾中",
          "14. 常常哭叫",
          "15. 虐待动物",
          "16. 虐待、欺侮别人或吝啬",
          "17. 好做白日梦或呆想",
          "18. 故意伤害自己或企图自杀 ",
          "19. 需要别人经常注意自己",
          "20. 破坏自己的东西",
          "21. 破坏家里或其他儿童的东西",
          "22. 在家不听话",
          "23. 在学校不听话",
          "24. 不肯好好吃饭",
          "25. 不与其他儿童相处",
          "26. 有不良行为后不感到内疚",
          "27. 易嫉妒",
          "28. 好吃不能作为食物的东西（说明内容）",
          "29. 除怕上学外，还害怕某些动物、处境或地方（说明内容）",
          "30. 怕上学",
          "31. 怕自己想坏念头或做坏事",
          "32. 觉得自己必须十全十美",
          "33. 觉得或抱怨没有人喜欢自己",
          "34. 觉得别人存心捉弄自己",
          "35. 觉得自己无用或有自卑感",
          "36. 身体经常弄伤，容易出事故",
          "37. 经常打架",
          "38. 常被人戏弄",
          "39. 爱和出麻烦的儿童在一起",
          "40. 听到某些实际上没有的声音（说明内容）",
          "41. 冲动或行为粗鲁",
          "42. 喜欢孤独",
          "43. 撒谎或欺骗",
          "44. 咬指甲",
          "45. 神经过敏，容易激动或紧张",
          "46. 动作紧张或带有抽动性（说明内容）",
          "47. 做恶梦",
          "48. 不被其他儿童喜欢",
          "49. 便秘",
          "50. 过度恐惧或担心",
          "51. 感到头昏",
          "52. 过份内疚",
          "53. 吃得过多",
          "54. 过份疲劳",
          "55. 身体过重",
          "56. 找不到原因的躯体症状：",
          "a. 疼痛",
          "b. 头痛",
          "c. 恶心想吐",
          "d. 眼睛有问题（说明内容。译注：不包括近视及器质性眼病）",
          "e. 发疹或其他皮肤病",
          "f. 腹部疼痛或绞痛",
          "g. 呕吐",
          "h. 其他（说明内容）",
          "57. 对别人身体进行攻击",
          "58. 挖鼻孔、皮肤或身体其他部分（说明内容）",
          "59. 公开玩弄自己的生殖器",
          "60. 过多地玩弄自己的生殖器",
          "61. 功课差",
          "62. 动作不灵活",
          "63. 喜欢和年龄较大的儿童在一起",
          "64. 喜欢和年龄较小的儿童在一起",
          "65. 不肯说话",
          "66. 不断重复某些动作，强迫行为（说明内容）",
          "67. 离家出走",
          "68. 经常尖叫",
          "69. 守口如瓶，有事不说出来",
          "70. 看到某些实际上没有的东西（说明内容）",
          "71. 感到不自然或容易发窘",
          "72. 玩火（包括玩火柴或打火机——译注）",
          "73. 性方面的问题（说明内容）",
          "74. 夸耀自己或胡闹",
          "75. 害羞或胆小  ",
          "76. 比大多数孩子睡得少",
          "77. 比大多数孩子睡得多（说明多多少。译注：不包括赖床）",
          "78. 玩弄粪便",
          "79. 言语问题（说明内容。译注：例如口吃不清）",
          "80. 茫然凝视",
          "81. 在家偷东西",
          "82. 在外偷东西",
          "83. 收藏自己不需要的东西（说明内容。译注：不包括集邮等爱好）",
          "84. 怪异行为（说明内容。译注：不包括其他条已提及者）",
          "85. 怪异想法（说明内容。译注：不包括其他条已提及者）",
          "86. 固执、绷着脸或容易激怒",
          "87. 情绪突然变化",
          "88. 常常生气",
          "89. 多疑",
          "90. 咒骂或讲粗话",
          "91. 声言要自杀",
          "92. 说梦话或有梦游（说明内容）",
          "93. 话太多",
          "94. 常戏弄他人",
          "95. 乱发脾气或脾气暴躁",
          "96. 对性的问题想得太多",
          "97. 威胁他人",
          "98. 吮吸大拇指",
          "99. 过分要求整齐清洁",
          "100. 睡眠不好（说明内容）",
          "101. 逃学",
          "102. 不够活跃，动作迟钝或精力不足",
          "103. 闷闷不乐，悲伤或抑郁",
          "104. 说话声音特别大",
          "105. 喝酒或使用成瘾药（说明内容）",
          "106. 损坏公物",
          "107. 白天遗尿",
          "108. 夜间遗尿",
          "109. 爱哭诉",
          "110. 希望成为异性",
          "111. 孤独、不合群",
          "112. 忧虑重重",
        ],
      },
      //辅助数据
      devs: {
        class1: undefined,
        class2: undefined,
        class3: undefined
      },
      //返回的数据
      res: {
        first: {},
        data_2: [],
        data_3: []
      },
      scaleScreenId: null,
      data:{},
      rules: {
        marks: [
          {
            validator: (rule, value, callback) => {
              if (this.form.third.marks.length !== this.questions.v8.length) {
                callback(new Error('请完成所有行为问题的评分'));
              } else {
                callback();
              }
            },
            trigger: 'change'
          }
        ]
      }
    };
  },
  created() {
      console.log(this.$route.query)
      this.data = this.$route.query.row
      // 接收上个页面传来的scaleScreenId
      this.scaleScreenId = this.$route.query.row.scaleScreenId
      console.log(this.scaleScreenId)
  },
  methods: {
    goBack(){
      this.$router.go(-1);
    },
    // 切换到上一部分
    prevPart() {
      if (this.currentPart > 1) {
        this.currentPart--;
      }
    },
    // 切换到下一部分
    nextPart() {
      if (this.currentPart < 3) {
        this.currentPart++;
      }
    },
    onSubmit() {
      console.log("this.form",this.form)
      getDcpResult(this.form).then((response) => {
        if (response.data.code != 500){
          // this.data.status = 1
          const dcpResult = {
            scaleScreenId:this.scaleScreenId,
            status:1
          }

          console.log("getDcpResult:",response)

          updateScreen(dcpResult).then(Response =>{
            console.log("dcpResult",dcpResult)
            if (Response.code === 200){
              // this.$message({
              //   message: '恭喜你，提交成功',
              //   type: 'success'
              // });
            }
          })

          console.log("response",response)
          console.log(response);
          this.res = response.data; // 现在`this`正确指向Vue实例

          const DcpScaleScreen = {
            scaleScreenId:this.scaleScreenId,
            resultContent:JSON.stringify(this.res)
          }

          addResult(DcpScaleScreen).then(
            response =>{
              if (response.code === 200){
                this.$message({
                  message: '提交成功!',
                  type: 'success'
                });
              }
            }
          )
          this.$emit('refresh-list');
          this.goBack()
        }else {
          this.$message({
            message: '请选择全部内容后再次提交!',
            type: 'error'
          });
        }
      })
    },

    fun() {
      console.log(this.form);
    }
  }
};
</script>

<style scoped>
.form-container {
  margin: 20px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.demo-form {
  padding: 20px;
}

/* 确保文字左侧对齐 */
.el-form-item__label {
  text-align: left;
  padding-left: 0; /* 去掉左侧内边距 */
}

/* 调整输入框的宽度 */
.bottom-border-input {
  width: 100%;
}

/* 设置 <p> 标签文本居中 */
.center-text {
  text-align: center; /* 文本居中 */
  margin: 10px 0; /* 调整上下间距 */
}

.select-container {
  margin-top: 10px;
  margin-left: 10px;
}

.row {
  display: flex;
  align-items: center; /* 垂直居中 */
  margin-bottom: 10px; /* 调整行间距 */
}

/* 调整 p 标签的样式 */
.row p {
  margin: 0; /* 去掉默认的 margin */
  margin-top: 5px;
  width: 150px; /* 固定宽度，确保对齐 */
  font-size: 14px;
}

.description_item {
  margin-top: 15px;
  margin-bottom: 15px;
}
</style>
